package com.atdm.LogGPS;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.atdm.util.Log;

/**
 * Created by liaoyichang on 2015/4/21.
 */
public class SatelliteFragment extends Fragment implements DataFlush  {
    protected SatelliteSnrView mSateView =null;
    protected SatelliteCompassView mCompView =null;
        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View layout = inflater.inflate(R.layout.satellite_layout,
                container, false);
            mSateView = (SatelliteSnrView) layout.findViewById(R.id.sate_snr);
            mCompView = (SatelliteCompassView) layout.findViewById(R.id.sate_comp);
        return layout;
    }

    @Override
    public void onDataChange(String act) {
        if( TrackService.MSG_Satellite.equals(act)) {
            if (mSateView != null) mSateView.invalidate();
            if (mCompView != null) mCompView.invalidate();
        }
    }
    @Override
    public void onSelected(){
        if (mSateView != null) mSateView.invalidate();
        if (mCompView != null) mCompView.invalidate();
    }
    public void onDestroy(){
        Log.i("SatelliteFragment.onDestroy()");
        super.onDestroy();
    }
    public void onResume() {
        super.onResume();
        Log.i("SatelliteFragment.onResume()");
        if( mSateView!=null ) mSateView.invalidate();
        if( mCompView!=null ) mCompView.invalidate();
    }
}
